gtkprintbackendfile: Fix infinite loop in _cairo_write()
authorCarlos Garcia Campos <cgarcia@igalia.com>
Wed, 3 Oct 2012 17:34:09 +0000 (19:34 +0200)
committerCarlos Garcia Campos <carlosgc@gnome.org>
Sun, 14 Apr 2013 10:19:09 +0000 (12:19 +0200)
commit2adacca119aad1c8f62b02028762dc454aee4474
tree6e037e7b9282c47fc967793694c72718d4e2727b
parent4445dce697eb343bb7a7ca2ac20b2eeaade927fd
gtkprintbackendfile: Fix infinite loop in _cairo_write()

It can happen if the io channel has been closed. In that case
g_io_channel_write_chars() returns early because of a g_return macro
that checks if the io channel is writable. When returning from g_return
macros, the bytes written output parameter is not updated and the error
is not filled, so the error is not detected and the written variable is
used uninitialized. We should check the return value of
g_io_channel_write_chars() to break the loop.

https://bugzilla.gnome.org/show_bug.cgi?id=685419
modules/printbackends/file/gtkprintbackendfile.c